home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gtalk / gtalk.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  3KB  |  81 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import jabber
  5. from logging import getLogger
  6. from common.actions import action
  7. from gtalkStream import GoogleTalkStream
  8. log = getLogger('gtalk.protocol')
  9. status_state_map = {
  10.     'available': 'normal',
  11.     'free for chat': 'normal',
  12.     'do not disturb': 'dnd' }
  13. GTALK_WAY = False
  14.  
  15. class GoogleTalk(jabber.protocol):
  16.     name = 'gtalk'
  17.     service = 'gtalk'
  18.     status_state_map = status_state_map
  19.     
  20.     def __init__(self, username, *a, **k):
  21.         self._idle = None
  22.         self._show = None
  23.         if '@' not in username:
  24.             username += '@gmail.com'
  25.         
  26.         jabber.protocol.__init__(self, username, *a, **k)
  27.         self.stream_class = GoogleTalkStream
  28.  
  29.     if not GTALK_WAY:
  30.         
  31.         def set_idle(self, yes):
  32.             if yes:
  33.                 self._idle = self.show
  34.                 self.show = 'away'
  35.             else:
  36.                 self.show = self._idle
  37.             self.presence_push()
  38.  
  39.         
  40.         def set_message(self, message, status, format = None):
  41.             log.info('set_message(%s): %r', status, message)
  42.             state = status_state_map.get(status.lower(), 'dnd')
  43.             self.show = None if state != 'normal' else None
  44.             self._idle = self.show
  45.             self.status = message
  46.             self.presence_push()
  47.  
  48.     else:
  49.         
  50.         def set_idle(self, yes):
  51.             self._idle = bool(yes)
  52.             self.presence_push()
  53.  
  54.         
  55.         def set_message(self, message, status, format = None, default_status = 'dnd'):
  56.             jabber.protocol.set_message(self, message, status, format, default_status)
  57.  
  58.         
  59.         def __set_show(self, state):
  60.             self._show = state
  61.  
  62.         
  63.         def __get_show(self):
  64.             if self._idle:
  65.                 return 'away'
  66.             else:
  67.                 return self._show
  68.  
  69.         show = property(__get_show, __set_show)
  70.     
  71.     def change_password(self, *a):
  72.         pass
  73.  
  74.     change_password = action((lambda self: pass))(change_password)
  75.     
  76.     def edit_vcard(self, *a, **k):
  77.         pass
  78.  
  79.     edit_vcard = action((lambda self: pass))(edit_vcard)
  80.  
  81.